from time import sleep

from appium.webdriver.common.appiumby import AppiumBy

from base.base_page import BasePage


class MenuPage(BasePage):
    _WARNING_SERVICE = (AppiumBy.XPATH, '//*[@text="預報及警告服務"]')
    _NINE_DAY = (AppiumBy.XPATH, '//*[@text="九天預報"]')

    def __init__(self, driver):
        super().__init__(driver)

    def click_nine_day(self):
        self.search_and_click(self._WARNING_SERVICE)
        sleep(2)
        self.search_and_click(self._NINE_DAY)

        from pages.nine_day_page import NineDayPage
        return NineDayPage(self.driver)